import { IIile, ILevel } from '../Levels'
import Singleton from '../Base/Singleton'

import { TileManager } from '../Scripts/Tile/TileManager'

// 实现单例
export default class DataManager extends Singleton {
  mapInfo: IIile[][] = []
  mapRowCount = 0 //行
  mapColCount = 0 //列

  levelIndex = 1 // 当前关卡索引
  player = null //玩家
  woodenskeletons = [] //敌人列表，有多个
  door = null
  bursts = [] //地裂
  spkies = [] //尖刺
  smokes = [] //烟雾
  // 记录数据栈
  records = []

  tileInfo: TileManager[][] = []

  // 使用 getter 可以让调用代码更加简洁。你可以直接使用 DataManager.Instance 而不是 DataManager.getInstance()，使代码读起来更自然，就像访问一个属性一样。
  static get Instance() {
    return super.getInstance<DataManager>()
  }

  // 重置
  reset() {
    this.mapInfo = []
    this.tileInfo = []
    this.player = null
    this.woodenskeletons = []
    this.door = null
    this.bursts = []
    this.spkies = []
    this.smokes = []
    this.records = []
    this.mapRowCount = 0
    this.mapColCount = 0
  }
}
